import java.util.*;

/**
 * @author LKQ
 * @date 2022/5/15 16:07
 * @description 排序
 */
public class Solution {
    public static void main(String[] args) {

    }
    public int maxConsecutive(int bottom, int top, int[] special) {
        Arrays.sort(special);
        int max = 0, n = special.length;
        max = Math.max(special[0] - bottom, max);
        max = Math.max(top - special[n - 1], max);
        for (int i = 1; i < n; i++) {
            max = Math.max(special[i] - special[i -  1] - 1, max);
        }
        return max;
    }
}
